package com.xywy.bloodandroid.act;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.xywy.bloodandroid.R;
import com.xywy.bloodandroid.base.BaseActivity;

public class HosptailLevelAct extends BaseActivity{

	private TextView textview11;
	private TextView textview12;
	private TextView textview13;
	private TextView textview14;
	private TextView textview21;
	private TextView textview22;
	private TextView textview23;
	private TextView textview24;
	private Button confirm_button;
    
	private String doctor_level_name;
	@Override
	protected void initView(Bundle savedInstanceState) {
		setContentView(R.layout.act_hosptail_level);
		
		textview11 = (TextView) findViewById(R.id.textview11);
		textview12 = (TextView) findViewById(R.id.textview12);
		textview13 = (TextView) findViewById(R.id.textview13);
		textview14 = (TextView) findViewById(R.id.textview14);
		
		textview21 = (TextView) findViewById(R.id.textview21);
		textview22 = (TextView) findViewById(R.id.textview22);
		textview23 = (TextView) findViewById(R.id.textview23);
		textview24 = (TextView) findViewById(R.id.textview24);
		
		confirm_button = (Button) findViewById(R.id.confirm_button);
	}

	@Override
	protected void initListener() {
		confirm_button.setOnClickListener(this);
		
		textview11.setOnClickListener(this);
		textview12.setOnClickListener(this);
		textview13.setOnClickListener(this);
		textview14.setOnClickListener(this);
		
		textview21.setOnClickListener(this);
		textview22.setOnClickListener(this);
		textview23.setOnClickListener(this);
		textview24.setOnClickListener(this);
		
	}

	@Override
	protected void initData() {
		
	}
    @Override
    public void onClick(View v) {
    	super.onClick(v);
    	switch (v.getId()) {
		case R.id.textview11:
			doctor_level_name="不限";
			
			textview11.setBackgroundResource(R.color.hosptial_name);
			
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview14.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			textview23.setBackgroundResource(R.drawable.doctor_level_bg);
			textview24.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview12:
			doctor_level_name="三级甲等";
			
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.color.hosptial_name);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview14.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			textview23.setBackgroundResource(R.drawable.doctor_level_bg);
			textview24.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview13:
			
			doctor_level_name="三级乙等";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.color.hosptial_name);
			textview14.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			textview23.setBackgroundResource(R.drawable.doctor_level_bg);
			textview24.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview14:
			doctor_level_name="三级丙等";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview14.setBackgroundResource(R.color.hosptial_name);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			textview23.setBackgroundResource(R.drawable.doctor_level_bg);
			textview24.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
			
		case R.id.textview21:
			doctor_level_name="三级";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview14.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.color.hosptial_name);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			textview23.setBackgroundResource(R.drawable.doctor_level_bg);
			textview24.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview22:
			doctor_level_name="二级甲等";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview14.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.color.hosptial_name);
			textview23.setBackgroundResource(R.drawable.doctor_level_bg);
			textview24.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview23:
			doctor_level_name="二级乙等";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview14.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			textview23.setBackgroundResource(R.color.hosptial_name);
			textview24.setBackgroundResource(R.drawable.doctor_level_bg);
			break;
		case R.id.textview24:
			doctor_level_name="二级丙等";
			textview11.setBackgroundResource(R.drawable.doctor_level_bg);
			textview12.setBackgroundResource(R.drawable.doctor_level_bg);
			textview13.setBackgroundResource(R.drawable.doctor_level_bg);
			textview14.setBackgroundResource(R.drawable.doctor_level_bg);
			textview21.setBackgroundResource(R.drawable.doctor_level_bg);
			textview22.setBackgroundResource(R.drawable.doctor_level_bg);
			textview23.setBackgroundResource(R.drawable.doctor_level_bg);
			textview24.setBackgroundResource(R.color.hosptial_name);
			break;
			
		case R.id.confirm_button:
			
			// 成功的时候将备注名返回给上一个界面
			Intent date = new Intent();
			date.putExtra("doctor_level_name", doctor_level_name);
			setResult(0, date);
			finish();
			break;
		default:
			break;
		}
    }
    
    
}
